﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;

/// <summary>
/// Summary description for datNhomUser
/// </summary>
public class datNhomUser
{

    string constr = System.Configuration.ConfigurationManager.ConnectionStrings["conStr3"].ConnectionString;
	public datNhomUser()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    SqlCommand cmd;
    SqlDataReader dr;
    public List<entNhomUser> getall()
    {
        SqlConnection sqlConnection = new SqlConnection(constr);
        sqlConnection.Open();
        cmd = new SqlCommand("sp_NhomUserSelectAll", sqlConnection);
        cmd.CommandType = CommandType.StoredProcedure;
        dr = cmd.ExecuteReader();
        entNhomUser entsv = new entNhomUser();
        List<entNhomUser> lst = new List<entNhomUser>();
        while (dr.Read())
        {
            entsv = new entNhomUser();
            entsv.NhomUserId = int.Parse(dr["NhomUserId"].ToString());
            entsv.TenNhom = dr["TenNhomUser"].ToString();
            lst.Add(entsv);
        }
        dr.Close();
        sqlConnection.Close();
        return lst;
    }
    public List<entNhomUser> getNhomNhanYKien()
    {
        SqlConnection sqlConnection = new SqlConnection(constr);
        sqlConnection.Open();
        cmd = new SqlCommand("sp_NhomUserNhanYkien", sqlConnection);
        cmd.CommandType = CommandType.StoredProcedure;
        dr = cmd.ExecuteReader();
        entNhomUser entsv = new entNhomUser();
        List<entNhomUser> lst = new List<entNhomUser>();
        while (dr.Read())
        {
            entsv = new entNhomUser();
            entsv.NhomUserId = int.Parse(dr["NhomUserId"].ToString());
            entsv.TenNhom = dr["TenNhomUser"].ToString();
            lst.Add(entsv);
        }
        dr.Close();
        sqlConnection.Close();
        return lst;
    }
}